var CKEDITOR = window.parent.CKEDITOR;
var img_float;

function load_folder(url){
	$('.gallery_warpper').load(url);
	return false;
}

function insertImage(file, alt)
{
	if(replace_html)
	{
		replace_html.remove();
	}
	var img_width = document.getElementById('insert_width').value;
	
	window.parent.instance.insertHtml('<img class="insert-image" style="float: '+get_float()+';" src="' + SITE_URL + 'uploads/files/' + file + '" alt="' + alt + '" width="'+img_width+'" />');
	//window.close();
}


function get_float()
{
    img_float = jQuery('input[name=insert_float]:checked').val();
    return img_float;
}

// By default, insert (which will also replace)
var replace_html = null;

jQuery(function($){
	//tooltip
	$('.image_gallery img').hover( function() {
	    $(this).attr('title', 'Click to insert image');
	});
});
